<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();

            $table->string('order_no')->unique()->comment('订单编号');

            $table->string('user_id')->comment('用户');

            $table->integer('seller_id')->default(-1)->comment('商铺');

            $table->integer('pay_time')->default(0)->unsigned()->comment('支付时间');

            $table->integer('delivery_type')->unsigned()->default(1)->comment('配送方式,1是快递，2是自提');

            $table->string('note')->default('')->comment('备注');

            $table->decimal('total_money')->unsigned()->comment('订单总金额,不包含如何优惠');

            $table->decimal('real_money')->unsigned()->comment('订单总金额(优惠后金额)');

            $table->decimal('pay_money')->nullable()->unsigned()->comment('实际支付金额');

            $table->decimal('freight')->unsigned()->comment('运费');

            $table->integer('status')->unsigned()->comment('1待付款，11已支付，22已取消');



        });

        DB::statement("ALTER TABLE `order` COMMENT='订单表'");//表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order');
    }
}
